Skip to content

fix(enhanced): add runtime safety checks to prevent errors #3900

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

ScriptedAlchemy
Copy link
Member

Summary

  • Add defensive checks to prevent runtime errors when expected functions don't exist
  • First PR from the incremental plan to break up the massive enhanced package changes

Changes

  1. EmbedFederationRuntimeModule.ts: Added typeof oldStartup === 'function' check before calling oldStartup()
  2. StartupHelpers.ts: Added typeof __webpack_require__.x === "function" check before calling webpack_require.x()

Why

These defensive checks prevent runtime errors when expected functions don't exist in certain build configurations. This improves stability and prevents edge case failures.

Test Plan

  • Code changes are minimal and defensive
  • Existing tests pass
  • No breaking changes introduced

Related

  • Part of the incremental PR plan documented in INCREMENTAL_PR_PLAN_REVISED.md
  • Extracted from the larger share-filter branch changes

🤖 Generated with Claude Code

Copy link

changeset-bot bot commented Jul 11, 2025

⚠️ No Changeset found

Latest commit: 3191a4f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

netlify bot commented Jul 11, 2025

Deploy Preview for module-federation-docs ready!

Name Link
🔨 Latest commit 5beee9c
🔍 Latest deploy log https://app.netlify.com/projects/module-federation-docs/deploys/6871f9691349dd00082b9ea8
😎 Deploy Preview https://deploy-preview-3900--module-federation-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

- Add typeof check for oldStartup function in EmbedFederationRuntimeModule
  - Log warning when oldStartup is not a function
- Add typeof check for __webpack_require__.x in StartupHelpers
  - Log warning when __webpack_require__.x is not a function

These defensive checks prevent runtime errors when expected functions
don't exist in certain build configurations. The warnings help developers
debug issues.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@ScriptedAlchemy ScriptedAlchemy force-pushed the fix/runtime-safety-checks branch from d8773d7 to 9d5ace9 Compare July 12, 2025 04:19
ScriptedAlchemy added a commit that referenced this pull request Jul 12, 2025
Created a detailed plan to split the massive changes in packages/enhanced
into 12 focused, incremental PRs:
- Runtime safety fixes (COMPLETED - PR #3900)
- Hook renaming refactor
- Container hoisting improvements
- Share filtering features (broken into 4 sub-features)
- Layer support enhancements
- API exports and test coverage

Each PR is self-contained with clear dependencies documented.

Also added worktrees/ to .gitignore

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
ScriptedAlchemy and others added 2 commits July 11, 2025 21:23
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant